//
//  ShenPiXiangQingTableViewCell.m
//  JuBoCRM
//
//  Created by iMac on 2024/3/14.
//  Copyright © 2024 iningKe. All rights reserved.
//

#import "ShenPiXiangQingTableViewCell.h"
#import "PhotoContainer.h"
@implementation ShenPiXiangQingTableViewCell{
    PhotoContainer *_photosContainer;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    _photosContainer = [[PhotoContainer alloc] initWithMaxItemsCount:10];
    _photosContainer.canBrowser = YES;
    [self.contentView addSubview:_photosContainer];
    
}
- (void)setModel:(AllModel *)model {
    _model = model;
    NSDictionary *dataDic = model.modelInfoDictionary;
    
    _timeLabel.text = GetHandleString(dataDic, @"createTime");
    
    
    NSMutableArray *array = [NSMutableArray array];
    if([[dataDic objectForKey:@"img"] isKindOfClass:[NSArray class]]){
      NSArray *temp = [dataDic objectForKey:@"img"];
        for (NSDictionary *tempD in temp) {
            [array addObject:GetHandleString(tempD, @"urlImage")];
        }
    }
   
    

//
    _photosContainer.photoNamesArray = array;
    if(array.count > 0){
        _photosContainer.sd_layout
        .leftEqualToView(_imageLabel)
        .rightSpaceToView(self.contentView, 16)
        .topSpaceToView(_imageLabel, 9);
        _photosContainer.hidden = NO;
        [self setupAutoHeightWithBottomView:_photosContainer bottomMargin:9];
    }else{
        _photosContainer.sd_layout
        .leftEqualToView(_imageLabel)
        .rightSpaceToView(self.contentView, 16)
        .topSpaceToView(_imageLabel, 0);
        _photosContainer.hidden = YES;
        [self setupAutoHeightWithBottomView:_backView bottomMargin:9];
    }
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
